package com.bins.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqTopicConfig {

	@Bean
	public Queue topic1Queue() {
		return new Queue("topic1_queue");
	}

	@Bean
	public Queue topic2Queue() {
		return new Queue("topic2_queue");
	}

	@Bean
	public TopicExchange exchangeTopic() {
		return new TopicExchange("exchange_topic");
	}

	@Bean
	public Binding bindingTopic1() {
		return BindingBuilder.bind(topic1Queue()).to(exchangeTopic()).with("topic.#");
	}

	@Bean
	public Binding bindingTopic2() {
		return BindingBuilder.bind(topic2Queue()).to(exchangeTopic()).with("topic.*");
	}

}